<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Silverlight Project Test Page </title>
    <style type="text/css">
    html, body {
	    height: 100%;
	    overflow: auto;
    }
    body {
	    padding: 0;
	    margin: 0;
    }
    #silverlightControlHost {
	    height: 100%;
    }
    </style>
    <script src="../script/Silverlight.js" type="text/javascript"></script>
    <script type="text/javascript">
        function onSilverlightError(sender, args) {        
            var appSource = "";
            if (sender != null && sender != 0) {
                appSource = sender.getHost().Source;
            } 
            var errorType = args.ErrorType;
            var iErrorCode = args.ErrorCode;
            
            var errMsg = "Unhandled Error in Silverlight 2 Application " +  appSource + "\n" ;

            errMsg += "Code: "+ iErrorCode + "    \n";
            errMsg += "Category: " + errorType + "       \n";
            errMsg += "Message: " + args.ErrorMessage + "     \n";

            if (errorType == "ParserError")
            {
                errMsg += "File: " + args.xamlFile + "     \n";
                errMsg += "Line: " + args.lineNumber + "     \n";
                errMsg += "Position: " + args.charPosition + "     \n";
            }
            else if (errorType == "RuntimeError")
            {           
                if (args.lineNumber != 0)
                {
                    errMsg += "Line: " + args.lineNumber + "     \n";
                    errMsg += "Position: " +  args.charPosition + "     \n";
                }
                errMsg += "MethodName: " + args.methodName + "     \n";
            }

            throw new Error(errMsg);
        }
        function parseKeyframe(p0, p1, p2, p3) {
            document.getElementById("silverplayer").Content.js.SetMeta(p0, p1, "" + p2, "" + p3);
        }
        function closeWindow()
		{
			//document.body.removeChild(document.getElementById('ads_14'));
			//return '';
			return false;
		}
		//var bizurl = 'http://biz.vsdn.tv380.com/playlive.php?';
		var bizurl = 'http://biz.vsdn.bigtv.com.cn/playlive.php?';
        var playurl = '';
        var channelname = '';
        function addLoadEvent(fn) {
    	    var oldonload = window.onload;
    	    if (typeof window.onload != 'function') {
    		    window.onload = fn;
    	    } else {
    		    window.onload = function() {
    			    if (oldonload) {
    				    oldonload();
    			    }
    			    fn();
    		    };
    	    }
        }
		function goOn(url)
		{		    
    	    //parent.document.getElementById("debug").innerHTML +="<br>"+url;
    	    //url=url.replace('1.75','1.76');
    	    var str = "isvod=false,autostart=true,autohide=true,cc=false,markers=false,m="+url;
    	    Silverlight.createObjectEx({ source: '../ClientBin/VideoPlayer.xap',
            parentElement: document.getElementById("silverlightControlHost"),
            id: "silverplayer",
            properties: { width: '700', height: '450', version: '1.0',background:'black' },
            initParams: str
            });
		}		
		function getplayurl(uuid)
        {
            parent.document.getElementById("debug").innerHTML +="uuid:"+uuid;
    	    var playJS = document.createElement("script");
    	    playJS.src=bizurl+uuid+"|js";
    	    playJS.type='text/javascript';
    	    playJS.defer=true;
    	    document.getElementById("LPJS").appendChild(playJS);
        }
        function initPage(fn) {
    	    var tmp=parent.getvalue();
    	    var tmpurl = tmp.substr(0, tmp.indexOf('|') );
    	    channelname = decodeURI(tmp.substr(tmp.indexOf('|')+1 ));
   	        if (tmpurl) {getplayurl(tmpurl);} 
   	        else{
   		        //document.getElementById("playing").style.className="playing";
   	        }
        }
        function dropPage()
        {
    	    try{curPlayer.mdivStop.onclick(); }catch(err){}
    	    try{curPlayer.Delete();curPlayer = null;}catch(err){}
        }
        addLoadEvent(initPage);
    </script>
</head>
<body  style="background:black">
	<div id='errorLocation' style="font-size: small;color: Gray;"></div>
    <div id="silverlightControlHost">		
		<iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>
    </div>
    <div id="LJS" ></div><div id="VJS" ></div><div id="LPJS" ></div><div id="VPJS" ></div>
</body>
</html>
